{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Check if a competitor is named\n",
    "\n",
    "!!! note\n",
    "To download this example as a Jupyter notebook, click [here](https://github.com/guardrails-ai/guardrails/blob/main/docs/examples/competitors_check.ipynb).\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/zayd/workspace/guardrails/.venv/lib/python3.9/site-packages/torch/cuda/__init__.py:611: UserWarning: Can't initialize NVML\n",
      "  warnings.warn(\"Can't initialize NVML\")\n"
     ]
    }
   ],
   "source": [
    "import guardrails as gd\n",
    "from guardrails.validators import CompetitorCheck\n",
    "from rich import print"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using competitor check validator\n",
    "\n",
    "This validator checks LLM output to flag sentences naming one of your competitors and removes those sentences from the final output. When setting on-fail to 'fix' this validator will remove the flagged sentences from the output. You need to provide an extensive list of your competitors' names including all common variations (e.g. JP Morgan, JP Morgan Chase, etc.) the compilation of this list will have an impact on the ultimate outcome of the validation.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up a competitors list\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Generate competitors list\n",
    "competitors_list = [\n",
    "    \"Acorns\",\n",
    "    \"Citigroup\",\n",
    "    \"Citi\",\n",
    "    \"Fidelity Investments\",\n",
    "    \"Fidelity\",\n",
    "    \"JP Morgan Chase and company\",\n",
    "    \"JP Morgan\",\n",
    "    \"JP Morgan Chase\",\n",
    "    \"JPMorgan Chase\",\n",
    "    \"Chase\" \"M1 Finance\",\n",
    "    \"Stash Financial Incorporated\",\n",
    "    \"Stash\",\n",
    "    \"Tastytrade Incorporated\",\n",
    "    \"Tastytrade\",\n",
    "    \"ZacksTrade\",\n",
    "    \"Zacks Trade\",\n",
    "]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up example text to test the validator\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define some text to test the validator\n",
    "text = \"\"\"\\\n",
    "In the dynamic realm of finance, several prominent entities have emerged as key players,\\\n",
    "leaving an indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving \\\n",
    "and investing with its user-friendly app. Citigroup, a multinational investment bank, stands as a \\\n",
    "pillar of financial expertise, offering a wide array of services to clients worldwide. HSBC, with \\\n",
    "its extensive global network, has become a powerhouse in the banking sector, catering to the needs \\\n",
    "of millions across different countries. JP Morgan, a venerable institution with a rich history, has \\\n",
    "established itself as a comprehensive financial powerhouse, providing a diverse range of services \\\n",
    "from investment banking to asset management. Santander, a Spanish multinational bank, has earned a \\\n",
    "reputation for its responsible banking practices and customer-centric approach, serving as a trusted \\\n",
    "financial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and \\\n",
    "Santander have redefined the financial landscape, shaping the way we save, invest, and manage our \\\n",
    "money on a global scale.\\\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Test the validator\n",
    "\n",
    "Here, we use the text we defined above as an example llm output (`llm_output`).\n",
    "\n",
    "We also set the on_fail behavior to 'fix' so that the validator will remove the sentences that mention competitors from the output.\n",
    "We can adjust this behavior by changing it to 'reask' or 'throw'.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #800080; text-decoration-color: #800080; font-weight: bold\">ValidationOutcome</span><span style=\"font-weight: bold\">(</span>\n",
       "    <span style=\"color: #808000; text-decoration-color: #808000\">raw_llm_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">an indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing with its </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial expertise, offering </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">a wide array of services to clients worldwide. HSBC, with its extensive global network, has become a powerhouse in </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">the banking sector, catering to the needs of millions across different countries. JP Morgan, a venerable </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">institution with a rich history, has established itself as a comprehensive financial powerhouse, providing a </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">diverse range of services from investment banking to asset management. Santander, a Spanish multinational bank, has</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">earned a reputation for its responsible banking practices and customer-centric approach, serving as a trusted </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">financial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">redefined the financial landscape, shaping the way we save, invest, and manage our money on a global scale.'</span>,\n",
       "    <span style=\"color: #808000; text-decoration-color: #808000\">validated_output</span>=<span style=\"color: #008000; text-decoration-color: #008000\">'In the dynamic realm of finance, several prominent entities have emerged as key </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">players,leaving an indelible mark on the industry. HSBC, with its extensive global network, has become a powerhouse</span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">in the banking sector, catering to the needs of millions across different countries. Santander, a Spanish </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">multinational bank, has earned a reputation for its responsible banking practices and customer-centric approach, </span>\n",
       "<span style=\"color: #008000; text-decoration-color: #008000\">serving as a trusted financial partner to individuals and businesses alike.'</span>,\n",
       "    <span style=\"color: #808000; text-decoration-color: #808000\">reask</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>,\n",
       "    <span style=\"color: #808000; text-decoration-color: #808000\">validation_passed</span>=<span style=\"color: #00ff00; text-decoration-color: #00ff00; font-style: italic\">True</span>,\n",
       "    <span style=\"color: #808000; text-decoration-color: #808000\">error</span>=<span style=\"color: #800080; text-decoration-color: #800080; font-style: italic\">None</span>\n",
       "<span style=\"font-weight: bold\">)</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1;35mValidationOutcome\u001b[0m\u001b[1m(\u001b[0m\n",
       "    \u001b[33mraw_llm_output\u001b[0m=\u001b[32m'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving\u001b[0m\n",
       "\u001b[32man indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing with its \u001b[0m\n",
       "\u001b[32muser-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial expertise, offering \u001b[0m\n",
       "\u001b[32ma wide array of services to clients worldwide. HSBC, with its extensive global network, has become a powerhouse in \u001b[0m\n",
       "\u001b[32mthe banking sector, catering to the needs of millions across different countries. JP Morgan, a venerable \u001b[0m\n",
       "\u001b[32minstitution with a rich history, has established itself as a comprehensive financial powerhouse, providing a \u001b[0m\n",
       "\u001b[32mdiverse range of services from investment banking to asset management. Santander, a Spanish multinational bank, has\u001b[0m\n",
       "\u001b[32mearned a reputation for its responsible banking practices and customer-centric approach, serving as a trusted \u001b[0m\n",
       "\u001b[32mfinancial partner to individuals and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have \u001b[0m\n",
       "\u001b[32mredefined the financial landscape, shaping the way we save, invest, and manage our money on a global scale.'\u001b[0m,\n",
       "    \u001b[33mvalidated_output\u001b[0m=\u001b[32m'In the dynamic realm of finance, several prominent entities have emerged as key \u001b[0m\n",
       "\u001b[32mplayers,leaving an indelible mark on the industry. HSBC, with its extensive global network, has become a powerhouse\u001b[0m\n",
       "\u001b[32min the banking sector, catering to the needs of millions across different countries. Santander, a Spanish \u001b[0m\n",
       "\u001b[32mmultinational bank, has earned a reputation for its responsible banking practices and customer-centric approach, \u001b[0m\n",
       "\u001b[32mserving as a trusted financial partner to individuals and businesses alike.'\u001b[0m,\n",
       "    \u001b[33mreask\u001b[0m=\u001b[3;35mNone\u001b[0m,\n",
       "    \u001b[33mvalidation_passed\u001b[0m=\u001b[3;92mTrue\u001b[0m,\n",
       "    \u001b[33merror\u001b[0m=\u001b[3;35mNone\u001b[0m\n",
       "\u001b[1m)\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Create the Guard with the CompetitorCheck Validator\n",
    "guard = gd.Guard.from_string(\n",
    "    validators=[CompetitorCheck(competitors=competitors_list, on_fail=\"fix\")],\n",
    "    description=\"testmeout\",\n",
    ")\n",
    "\n",
    "# Test with a given text\n",
    "output = guard.parse(\n",
    "    llm_output=text,\n",
    "    metadata={},\n",
    ")\n",
    "\n",
    "print(output)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Logs\n",
       "└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
       "    │ <span style=\"background-color: #f0f8ff\">╭──────────────────────────────────────────────── Prompt ─────────────────────────────────────────────────╮</span> │\n",
       "    │ <span style=\"background-color: #f0f8ff\">│ No prompt                                                                                               │</span> │\n",
       "    │ <span style=\"background-color: #f0f8ff\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
       "    │ <span style=\"background-color: #e7dfeb\">╭──────────────────────────────────────────── Message History ────────────────────────────────────────────╮</span> │\n",
       "    │ <span style=\"background-color: #e7dfeb\">│ No message history.                                                                                     │</span> │\n",
       "    │ <span style=\"background-color: #e7dfeb\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">╭──────────────────────────────────────────── Raw LLM Output ─────────────────────────────────────────────╮</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an      │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ indelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing    │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ with its user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ expertise, offering a wide array of services to clients worldwide. HSBC, with its extensive global      │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ network, has become a powerhouse in the banking sector, catering to the needs of millions across        │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ different countries. JP Morgan, a venerable institution with a rich history, has established itself as  │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ a comprehensive financial powerhouse, providing a diverse range of services from investment banking to  │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ asset management. Santander, a Spanish multinational bank, has earned a reputation for its responsible  │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ banking practices and customer-centric approach, serving as a trusted financial partner to individuals  │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ and businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have redefined the         │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">│ financial landscape, shaping the way we save, invest, and manage our money on a global scale.           │</span> │\n",
       "    │ <span style=\"background-color: #f5f5dc\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">╭─────────────────────────────────────────── Validated Output ────────────────────────────────────────────╮</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">│ 'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an     │</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">│ indelible mark on the industry. HSBC, with its extensive global network, has become a powerhouse in the │</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">│ banking sector, catering to the needs of millions across different countries. Santander, a Spanish      │</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">│ multinational bank, has earned a reputation for its responsible banking practices and customer-centric  │</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">│ approach, serving as a trusted financial partner to individuals and businesses alike.'                  │</span> │\n",
       "    │ <span style=\"background-color: #f0fff0\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span> │\n",
       "    ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Logs\n",
       "└── ╭────────────────────────────────────────────────── Step 0 ───────────────────────────────────────────────────╮\n",
       "    │ \u001b[48;2;240;248;255m╭─\u001b[0m\u001b[48;2;240;248;255m───────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m Prompt \u001b[0m\u001b[48;2;240;248;255m────────────────────────────────────────────────\u001b[0m\u001b[48;2;240;248;255m─╮\u001b[0m │\n",
       "    │ \u001b[48;2;240;248;255m│\u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255mNo prompt\u001b[0m\u001b[48;2;240;248;255m                                                                                              \u001b[0m\u001b[48;2;240;248;255m \u001b[0m\u001b[48;2;240;248;255m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;248;255m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
       "    │ \u001b[48;2;231;223;235m╭─\u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m Message History \u001b[0m\u001b[48;2;231;223;235m───────────────────────────────────────────\u001b[0m\u001b[48;2;231;223;235m─╮\u001b[0m │\n",
       "    │ \u001b[48;2;231;223;235m│\u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235mNo message history.\u001b[0m\u001b[48;2;231;223;235m                                                                                    \u001b[0m\u001b[48;2;231;223;235m \u001b[0m\u001b[48;2;231;223;235m│\u001b[0m │\n",
       "    │ \u001b[48;2;231;223;235m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m╭─\u001b[0m\u001b[48;2;245;245;220m───────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m Raw LLM Output \u001b[0m\u001b[48;2;245;245;220m────────────────────────────────────────────\u001b[0m\u001b[48;2;245;245;220m─╮\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mIn the dynamic realm of finance, several prominent entities have emerged as key players,leaving an \u001b[0m\u001b[48;2;245;245;220m    \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mindelible mark on the industry. Acorns, a fintech innovator, has revolutionized saving and investing \u001b[0m\u001b[48;2;245;245;220m  \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mwith its user-friendly app. Citigroup, a multinational investment bank, stands as a pillar of financial\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mexpertise, offering a wide array of services to clients worldwide. HSBC, with its extensive global \u001b[0m\u001b[48;2;245;245;220m    \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mnetwork, has become a powerhouse in the banking sector, catering to the needs of millions across \u001b[0m\u001b[48;2;245;245;220m      \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mdifferent countries. JP Morgan, a venerable institution with a rich history, has established itself as \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220ma comprehensive financial powerhouse, providing a diverse range of services from investment banking to \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220masset management. Santander, a Spanish multinational bank, has earned a reputation for its responsible \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mbanking practices and customer-centric approach, serving as a trusted financial partner to individuals \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mand businesses alike. Together, Acorns, Citi, HSBC, JP Morgan, and Santander have redefined the \u001b[0m\u001b[48;2;245;245;220m       \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m│\u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220mfinancial landscape, shaping the way we save, invest, and manage our money on a global scale.\u001b[0m\u001b[48;2;245;245;220m          \u001b[0m\u001b[48;2;245;245;220m \u001b[0m\u001b[48;2;245;245;220m│\u001b[0m │\n",
       "    │ \u001b[48;2;245;245;220m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m╭─\u001b[0m\u001b[48;2;240;255;240m──────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m Validated Output \u001b[0m\u001b[48;2;240;255;240m───────────────────────────────────────────\u001b[0m\u001b[48;2;240;255;240m─╮\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m'In the dynamic realm of finance, several prominent entities have emerged as key players,leaving an \u001b[0m\u001b[48;2;240;255;240m   \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mindelible mark on the industry. HSBC, with its extensive global network, has become a powerhouse in the\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mbanking sector, catering to the needs of millions across different countries. Santander, a Spanish \u001b[0m\u001b[48;2;240;255;240m    \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mmultinational bank, has earned a reputation for its responsible banking practices and customer-centric \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m│\u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240mapproach, serving as a trusted financial partner to individuals and businesses alike.'\u001b[0m\u001b[48;2;240;255;240m                 \u001b[0m\u001b[48;2;240;255;240m \u001b[0m\u001b[48;2;240;255;240m│\u001b[0m │\n",
       "    │ \u001b[48;2;240;255;240m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m │\n",
       "    ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# See guard history\n",
    "print(guard.history.last.tree)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
